<template>
	<view class="content">
		<view v-for="(item,index) in datas" :key="index" v-if="!repostMsg.zoom_group">
			<view class="item">
				<view class="item-left">
					<view class="item-title">{{item.group ? item.group.group_name : item.zoom.zoom_name}}({{item.group ? '问卷' : '组卷'}})</view>
					<view class="item-time">
						<i class="iconfont iconjieshushijian"></i>
						<text>完成时间：{{item.update_time.substring(0,10)}}</text>
					</view>
				</view>
				<view class="item-rght">
					<navigator class="btn" :url="'newreport?group_unid='+item.group.unid+'&respondent_id='+item.unid" v-if="item.group">查看报告</navigator>
					<view class="btn" v-if="item.zoom" @tap="repostMsgChange(item)">报告列表</view>
					<!-- <navigator class="btn" :url="'newreport?group_unid='+v.group_id+'&respondent_id='+item.fk_id+'&zoom_id='+v.zoom_id" v-if="item.zoom" v-for="v in item.zoom_group" :key="v.group_id">查看报告</navigator> -->
				</view>
			</view>
		</view>
		<view v-if="repostMsg.zoom_group" class="backc" @tap="repostMsg={}">返回</view>
		<view v-if="repostMsg.zoom_group" class="rplist"><text>(组卷){{repostMsg.zoom.zoom_name}}</text>报告列表</view>
		<view v-if="repostMsg.zoom_group" v-for="(item,index) in repostMsg.zoom_group">
			<view class="item">
				<view class="item-left">
					<view class="item-title">{{repostMsg.zoom.zoom_name}}(组卷)报告</view>
					<view class="item-time">
						<i class="iconfont iconjieshushijian"></i>
						<text>完成时间：{{repostMsg.update_time.substring(0,10)}}</text>
					</view>
				</view>
				<view class="item-rght">
					<navigator class="btn" :url="'newreport?group_unid='+item.group_id+'&respondent_id='+repostMsg.unid+'&zoom_id='+item.zoom_id">查看报告</navigator>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				datas: [],
				repostMsg: {}
			}
		},
		onBackPress() {
			if (this.repostMsg.unid) {
				this.repostMsg = {}
				return true
			}
		},
		onLoad() {
			// this.$qstapi.apiPost('respondent/getmy',{phone:uni.getStorageSync('phone')}).then(res=>{
			this.$qstapi.apiPost('respondent/getmy', {
				phone: uni.getStorageSync('phone')
			}).then(res => {
				if (res.data.code == 200) {
					this.datas = res.data.data;
				}
			})
		},
		methods: {
			repostMsgChange(item) {
				this.repostMsg = item
			}
		}
	}
</script>

<style>
	page {
		background: #FAFAFA;
	}

	.item {
		width: 630upx;
		padding: 30upx;
		margin: auto;
		margin-top: 30upx;
		background: #FFFFFF;
		border-radius: 20upx;
		display: flex;
		justify-content: flex-start;
	}

	.item-left {
		width: 450upx;
	}

	.item-title {
		height: 60upx;
		line-height: 60upx;
		font-size: 32upx;
		color: #333333;
	}

	.item-time {
		display: flex;
		justify-content: flex-start;
		align-items: center;
		font-size: 28upx;
		margin-top: 15upx;
	}

	.item-time i {
		color: #FF7171;
	}

	.item-time text {
		margin-left: 10upx;
		color: #333333;
	}

	.item-rght {
		width: 180upx;
	}

	.btn {
		width: 160upx;
		height: 60upx;
		background: linear-gradient(360deg, #FE765B 0%, #FEB968 100%);
		opacity: 1;
		border-radius: 40upx;
		text-align: center;
		line-height: 60upx;
		color: #FFFFFF;
		font-size: 30upx;
		margin-top: 20upx;
	}

	.rplist {
		width: 100%;
		text-align: center;
		padding: 30upx 0;
		font-size: 28upx;
		font-weight: bold;
		color: #9e9e9e;
	}

	.rplist text {
		color: #00D5A2;
	}

	.backc {
		position: fixed;
		color: #FFFFFF;
		width: 80upx;
		height: 80upx;
		line-height: 80upx;
		border-radius: 40upx;
		text-align: center;
		background-color: #949494;
		top: calc(50% - 40upx);
		left: 20upx;
	}
</style>
